#include <iostream>
#include "AnimalCore.h"
#include "Expr.h"

void test1();
void test2();

int main() {

    test1();
    //test2();
    return 0;
}

void test1(){
    Dog* dog1 = new Dog("haha");
    Cat cat1("hehe");
    Animal animal1("aaa");

    animal1.i_Am();
    animal1.hello();
    animal1.common();

    dog1->i_Am();
    dog1->hello();
    dog1->common();

    cat1.i_Am();
    cat1.hello();
    cat1.common();

    std::cout << "Below is dynamic bound\n";

    AnimalCore::invoke_base(dog1);
    AnimalCore::invoke_base(&animal1);
    AnimalCore::invoke_base(cat1);



}


void test2(){
    while(true){
        string str;
        cin >> str;
        const char *exp = str.c_str();
        //cout << exp;
        Expr expr(exp);
        cout << "inOrder: ";
        expr.print_mid();
        if(expr.getRoot()->getTokType() != ASSIGNEND){
            cout << "postFix: ";
            expr.print_postfix();
            cout << "preFix: ";
            expr.print_prefix();
            cout << "Result: " << expr.calculateVal() << endl;
        }
    }
}